import configparser

class iniManager:
    def __init__(self,fileName):
        self.fileName = fileName

        if __name__ != "__main__":
            self.path = "./window_source/conf/" + self.fileName
        else:
            self.path = "../window_source/conf/" + self.fileName

        self.iniHandle = configparser.ConfigParser()
        self.iniHandleReadPermission = self.iniHandle.read(self.path)

    def getDas(self):
        return self.iniHandleReadPermission

    def getValue(self,Option,KeyName):
        return self.iniHandle.get(Option,KeyName)

    def setDas(self,Option,Key,Value):
        self.iniHandle.set(Option,Key,Value)
        self.iniHandle.write(open(self.path,'w'))
        if __name__ != "__main__":
            self.path = "./window_source/conf/" + self.fileName
        else:
            self.path = "../window_source/conf/" + self.fileName

        self.iniHandle = configparser.ConfigParser()
        self.iniHandleReadPermission = self.iniHandle.read(self.path)



if __name__ == '__main__':
    test = iniManager('Setting.ini')
    print(test.getValue('Setting', 'AskTime'))
    test.setDas('Setting', 'AskTime', '1223')
    print(test.getValue('Setting', 'AskTime'))